home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Cookie_VBScript.asp < prev    next >
Encoding:
Text File  |  1998-09-16  |  1.8 KB  |  68 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <% Option Explicit %>
  3.  
  4. <!*************************
  5. This sample is provided for educational purposes only. It is not intended to be 
  6. used in a production environment, has not been tested in a production environment, 
  7. and Microsoft will not provide technical support for it. 
  8. *************************>
  9.  
  10. <%
  11.     'Changes to the HTTP response header, in which cookies
  12.     'are sent back to the client, must be made before
  13.     'sending any data to the user.
  14.     
  15.     Response.Expires = 0
  16.         
  17.     
  18.     'Get the last visit date/time string from the cookie that
  19.     'resides in the HTTP request header.
  20.     
  21.     Dim LastVisitCookie
  22.     LastVisitCookie = Request.Cookies("CookieVBScript")
  23.     
  24.     
  25.     'Send the current date/time string in a cookie enclosed
  26.     'in the response header. Note that because IE now uses
  27.     'case-sensitive cookie paths, we have explicitly set
  28.     'the cookie path to be that of the URL path to this
  29.     'page. By default, the path would be that of the
  30.     'IIS Application context for this page ("IISSAMPLES").
  31.     
  32.     Response.Cookies("CookieVBScript") = FormatDateTime(NOW)
  33. %>
  34.  
  35.  
  36. <HTML>
  37.     <HEAD>
  38.         <TITLE>Using Cookies</TITLE>
  39.     </HEAD>
  40.  
  41.     <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
  42.  
  43.         <FONT SIZE="4" FACE="ARIAL, HELVETICA">
  44.         <B>Using Cookies</B></FONT><BR>
  45.       
  46.         <HR SIZE="1" COLOR="#000000">
  47.         
  48.         <%        
  49.             If (LastVisitCookie = "") Then
  50.             
  51.                 'The cookie has never been set. This must
  52.                 'be the user's first visit to this page.
  53.                 
  54.                 Response.Write("Welcome to this page.")
  55.             Else
  56.  
  57.                 'Remind the user of the last time she/he
  58.                 'visited this page.
  59.  
  60.                 Response.Write("You last visited this page on " + LastVisitCookie)
  61.             End If        
  62.         %>
  63.  
  64.         <P><A HREF="Cookie_VBScript.asp">Revisit This Page</A>
  65.  
  66.     </BODY>
  67. </HTML>
  68.